<?php

namespace app\adminapi\controller\v1\portal;

use app\adminapi\controller\AuthController;
use app\services\portal\PortalSiteConfigurationService;
use think\facade\App;

/**
 * 站点配置类
 */
class PortalSiteConfiguration extends AuthController{


    public function __construct(App $app,PortalSiteConfigurationService $service)
    {
        parent::__construct($app);
        $this -> services = $service;
    }


    public function index(){
        $where = $this->request->postMore([
            ['website_id',$this  -> website],
        ]);
        return app() -> make('json') -> successful($this -> services -> index($where));
    }

    public function createOrUpdate(){
        $where = $this->request->postMore([
            ['website_id',$this  -> website],
            ['id',0],
            ['logo_img',''],
            ['assess_img',''],
            ['course_img',''],
            ['footer_img',''],
            ['phone',''],
            ['fax',''],
            ['email',''],
            ['address',''],
            ['link',''],
            ['qr_code',''],
            ['information',''],
            ['footer_cover_img',''],
            ['archival_information',''],
        ]);
        return app() -> make('json') -> successful($this -> services -> createOrUpdate($where));

    }

}